home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / standard / alloca.z / alloca
Encoding:
Text File  |  2002-10-03  |  2.2 KB  |  55 lines

  1. ALLOCA(3C)                                           Last changed: 10-20-98
  2.  
  3.  
  4. NNAAMMEE
  5.      aallllooccaa - Allocates dynamic space
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<aallllooccaa..hh>>
  9.  
  10.      vvooiidd **aallllooccaa ((uunnssiiggnneedd _s_i_z_e));;
  11.  
  12. IIMMPPLLEEMMEENNTTAATTIIOONN
  13.      IRIX systems
  14.  
  15. DDEESSCCRRIIPPTTIIOONN
  16.      aallllooccaa returns a pointer to _s_i_z_e bytes of uninitialized local stack
  17.      space.  Because the space is allocated using a built-in compiler
  18.      function, the allocation is quite fast.  If zero is passed as _s_i_z_e,
  19.      aallllooccaa returns a valid pointer (unlike some versions of mmaalllloocc, which
  20.      consider a zero size to be an error).
  21.  
  22.      The ##iinncclluuddee <<aallllooccaa..hh>> is required.
  23.  
  24.      Space allocated when a function ffoooo calls aallllooccaa is freed
  25.      automatically when ffoooo returns.
  26.  
  27.      It is an error to call ffrreeee with a pointer returned by aallllooccaa.
  28.  
  29.      Not all environments have aallllooccaa in their libraries, so code using it
  30.      is not necessarily portable.  Reasonably portable public domain
  31.      versions of this function are available from various sources on the
  32.      Internet and the World Wide Web.
  33.  
  34. FFIILLEESS
  35.      //uussrr//iinncclluuddee//aallllooccaa..hh
  36.  
  37. DDIIAAGGNNOOSSTTIICCSS
  38.      In this implementation, aallllooccaa cannot fail (although if _s_i_z_e makes the
  39.      process too large IRIX may kill the process).  Because aallllooccaa always
  40.      returns a valid pointer, no diagnostics are possible.  Portability may
  41.      be enhanced if the function calling aallllooccaa tests for a return value of
  42.      0 and handles 0 as an error.
  43.  
  44. CCAAVVEEAATTSS
  45.      Do not call aallllooccaa as an argument to another function, as in
  46.      ffoooo((aallllooccaa((2200))));;.  Use the following example instead:
  47.  
  48.           cp = alloca(20); foo(cp);
  49.  
  50. SSEEEE AALLSSOO
  51.      mmaalllloocc(3), ccaalllloocc(3), ffrreeee(3)
  52.  
  53.      This man page is available only online.
  54.  
  55.